<template>
	<view class="ys">
		<y-header></y-header>
		<view class="userbody">
			<view class="pc">
				<y-bread :name="pageName"></y-bread>
			</view>
			<view class="usermain">
				<view class="left">
					<y-usermenu></y-usermenu>
				</view>
				<view class="right">
					<view class="orderlist-title">
						<text>{{pageName}}</text>
					</view>
					<view class="no_list" v-if="content == ''">
						- {{$t('index.zwnr')}} -
					</view>
					<view class="passwordbox" v-else v-html="getContent(content)">
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		agree
	} from "@/api/api.js"
	export default {
		data() {
			return {
				pageName: '',
				aboutlist: {
					'brand': {
						name: this.$t('index.ppgs'),
						url: ''
					},
					'intro': {
						name: this.$t('index.sdjj'),
						url: ''
					},
					'agree': {
						name: this.$t('index.ysq'),
						url: ''
					},
					'shop': {
						name: this.$t('index.gwsm'),
						url: ''
					},
					'interests': {
						name: this.$t('index.hyqy'),
						url: ''
					}
				},
				content: ''
			}
		},
		onLoad(e) {
			if (e.type) {
				this.pageName = this.aboutlist[e.type].name
				this.agree(e.type)
			}
		},
		methods: {
			agree(type) {
				agree({
					type
				}).then(res => {
					this.content = res.data.content
				})
			},
			getContent(content) {
				if (typeof(content) == 'string')
					return content.replace(/<img src="/g, '<img style="max-width:100%;width:100%;display:block;" src="' +
						this.$config.websiteUrl)
			},
		}
	}
</script>

<style lang="scss">
	.userbody {
		max-width: 1180px;
		margin: 0 auto;
		margin-top: 20px;
		padding: 10px;
		box-sizing: border-box;
	}

	.usermain {
		display: flex;
		justify-content: space-between;

		.left {
			box-sizing: border-box;
			width: 25%;
			max-width: 265px;
			margin-top: 20px;
			margin-bottom: 20px;
		}

		.right {
			box-sizing: border-box;
			width: 75%;
			padding-right: 1%;
			margin-top: 20px;
			margin-bottom: 20px;

			.orderlist {
				margin-top: 15px;
			}

			.orderlist-title {
				font-size: 22px;
				border-left: 3px solid #4a4e5c;
				padding-left: 7px;
			}

			.passwordbox {
				line-height: 2;
				border: 1px solid #dddddd;
				padding: 30px;
				margin-top: 20px;

				.passinput-li {
					.pass-title {
						text-align: left;
						font-size: 14px;
						color: #333333;
						margin-bottom: 10px;
					}

					.pass-input {
						margin-bottom: 10px;
						height: 40px;
						line-height: 40px;
					}
				}

				.pass-btn {
					margin-top: 40px;
					margin-bottom: 20px;

					button {
						border-radius: 4.5px;
						font-size: 14px;
						text-align: center;
						box-sizing: border-box;
						display: inline-block;
						background-color: #ff5353;
						color: #ffffff;
						cursor: pointer;
						border: 1px solid #ff5353;
						width: 100%;
						height: 40px;
						line-height: 40px;
					}
				}
			}
		}
	}

	@media (max-width:768px) {
		.usermain {
			.left {
				display: none;
			}

			.right {
				width: 100%;
				padding: 0;

				.passwordbox {
					padding: 10px;
				}
			}
		}

		.pc {
			display: none;
		}
	}
</style>